package com.example.easydownloadback.util;

import com.example.easydownloadback.domin.UserDTO;

public class UserHolder {
    // 利用ThreadLocal的线程安全特性
    private static final ThreadLocal<UserDTO> userDTOThreadLocal = new ThreadLocal<>();

    public static void saveUser(UserDTO user){
        userDTOThreadLocal.set(user);
    }

    public static UserDTO getUser(){
        return userDTOThreadLocal.get();
    }

    public static void removeUser(){
        userDTOThreadLocal.remove();
    }
}
